package tdt4240.iddqd.sprites;

import org.anddev.andengine.entity.sprite.AnimatedSprite;
import org.anddev.andengine.opengl.texture.region.TiledTextureRegion;

public class Checkpoint extends AnimatedSprite {

	public final boolean endOfLevel;
	public final int id;
	public boolean visited;

	public Checkpoint(int id, float dx, float dy, float w, float h, boolean endOfLevel, TiledTextureRegion image){
		super(dx, dy, w, h, image);
		visited = false;

		if(!endOfLevel)
			setColor(0f, 0f, 1f, 0.25f);
		else
			setColor(1f, 0f, 0f, 0.25f);

		this.endOfLevel = endOfLevel;
		this.id = id;
	}

	/**
	 * Get X value of checkpoint center
	 * @return X value of checkpoint center
	 */
	public float centerX() {
		return getX() + getWidth()/2;
	}

	/**
	 * Get Y value of checkpoint center
	 * @return Y value of checkpoint center
	 */
	public float centerY() {
		return getY() + getHeight()/2;
	}
}
